﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;

namespace WpfApp1.Unit
{
    class dataunit
    {
        //集合输出
        public static String ArratListToString(ArrayList list)
        {
            string data = "{";
            foreach (string s in list)
            {
                data = data + s+",";
            }
            data = data + "}";
            return data;
        }
        //数组输出
        public static String shuzuToString(String[] list)
        {
            string data = "[";
            for(int i = 0; i< list.Length;i++)
            {
                data = data + list[i] + ",";
            }
            data = data + "]";
            return data;
        }
        //Unicode转字符串
        public static string Unicode2String(string source)
        {
            return new Regex(@"\\u([0-9A-F]{4})", RegexOptions.IgnoreCase | RegexOptions.Compiled).Replace(
                         source, x => string.Empty + Convert.ToChar(Convert.ToUInt16(x.Result("$1"), 16)));
        }

    }
}
